package router

import (
	appApi "TaskAssignmentSystem/internal/app/api"
	"github.com/kataras/iris/v12"
	"github.com/kataras/iris/v12/core/router"
)

func RegisterApiV10Router(apiRouter iris.Party) {
	apiRouter.PartyFunc("/app", func(admin iris.Party) {
		admin.Post("/login", appApi.LoginHandler)
	})
}

func RegisterApiV10AuthRouter(apiRouter iris.Party) {
	apiRouter.PartyFunc("/app", func(app router.Party) {
		app.PartyFunc("/user", func(user router.Party) {
			user.Party("/change_password", appApi.UserEditPassWordHandler)
		})
		app.PartyFunc("/project", func(p router.Party) {
			p.Post("/list", appApi.ProjectsHandler)
			p.Get("/{id:uint}", appApi.ProjectDetailHandler)
			p.Get("/index", appApi.ProjectIndexHandler)
			p.Post("/get_topic", appApi.GetTopicHandler)
		})
	})
}
